/*
 * Database.h
 *
 *  Created on: 13 Jul 2011
 *      Author: allan
 */

#ifndef DATABASE_H_
#define DATABASE_H_

// C++ includes
#include <list>
using namespace std;

// Boost includes
#include <boost/optional.hpp>
using boost::optional;

// GeoReact includes
#include "Utils.h"

class Database
{
public:
	typedef list<ReactionInfo>
	ReactionInfoList;
	
	typedef list<SpeciesInfo>
	SpeciesInfoList;
	
	typedef ReactionInfoList::const_iterator 
	ReactionInfoIterator;
	
	typedef SpeciesInfoList::const_iterator
	SpeciesInfoIterator;
	
public:
	static const Database& 
	GetInstance();
	
	const SpeciesInfoList&
	GetSpeciesInfoList() const;
	
	const ReactionInfoList& 
	GetReactionInfoList() const;
	
	const SpeciesInfo
	GetSpeciesInfo(const String& formula) const;
	
	const ReactionInfo
	GetReactionInfo(const String& reactantFormula) const;
	
	const optional<SpeciesInfo>
	FindSpeciesInfo(const String& formula) const;
	
	const optional<ReactionInfo>
	FindReactionInfo(const String& reactantFormula) const;
	
private:
	Database();
	Database(const String& filename);
	
private:
	ReactionInfoList reactions;
	SpeciesInfoList species;
};

#endif /* DATABASE_H_ */
